
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const productionGzipExtensions = ['js', 'css'];
module.exports = {
    // 部署应用包时的基本 URL
    publicPath:process.env.VUE_APP_PUBLIC_PATH,
    // 构建目录
    outputDir:process.env.VUE_APP_PUBLIC_PATH.replace('/','')||'dist',
    // sourceMap
    productionSourceMap: process.env.NODE_ENV === 'prod',
    configureWebpack: {
        plugins: [
            // 配置compression-webpack-plugin压缩
            new CompressionWebpackPlugin({
                algorithm: 'gzip',
                test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
                threshold: 10240,
                minRatio: 0.8
            })
        ]
    },
    // css 选项
    css: {
        loaderOptions: {
            less: {
                modifyVars: {
                    /* less 变量覆盖，用于自定义 ant design 主题 */
                    'primary-color': '#1890FF',
                    'link-color': '#1890FF',
                    'border-radius-base': '4px',
                },
                javascriptEnabled: true,
            }
        }
    },
    transpileDependencies: [],
    devServer: {
        port: 3000,
        proxy: {
            '/api': {
            target:"http://localhost:8899",
            ws: false,
            changeOrigin: true
            },
        }
    },
    lintOnSave: undefined
};
